<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>浏览器</title>

    <link rel="stylesheet" type="text/css" href="../../css/api.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/yzl.css"/>

    <style>
        .browser-close {
            display: inline-block;
            position: absolute;
            width: 30px;
            height: 45px;
            top: 15px;
            left: 40px;
            background-size: 17px 17px;
            background-position: left;
            background-repeat:no-repeat;
        }

        .browser-close.big {
            background-image: url(../../image/big/btn_close_white.png);
        }

        .browser-close.small {
            background-image: url(../../image/small/btn_close_white.png);
        }

        .browser-title {
            margin: 0 60px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
    </style>

</head>
<body>
<div class="header" id="app">
		<div id="back"  style="width:30px;" :class="BSImg" v-back.tapmode class="back"></div>
		<div style="float: right;font-size: 14px;margin-right: 6px;" v-open-win vurl="../user/kefu">智能客服</div>
    <div v-if="goods_info !==''" v-myclick="[goods_info.share, share]" style="width:20px;float:right;margin-right:10px;margin-top:5px" :class="BSImg"><img width="100%" v-src="'../../image/share_button.png'" tapmode></div>
    <div id="browser-close" class="browser-close" :class="BSImg" v-show="changeTime >= 2" onclick="closeWin()"></div>
    <div v-if="goods_info !==''" class="title browser-title">扎堆福利购</div>
    <div v-if="goods_info ==''" class="title browser-title">{{title}}</div>
</div>
</body>
<script src="../../script/api.js"></script>
<script src="../../script/vue.js"></script>
<script src="../../script/app.js"></script>
<script src="../../script/common.js"></script>
<script src="../../script/url.js"></script>
<script>

    var webBrowser,
        url,
        goods_id,
        goods_info = '',
        vm;

    apiready = function () {
        setBSImg();
        var back = document.getElementById('back');
        var browserClose = document.getElementById('browser-close');
        setTapmode([back, browserClose]);
        webBrowser = api.require('webViewModule');
        MNActionButton = api.require('PIActionButton');
        wx = api.require('wx');
        url = api.pageParam.url;
        console.log(url);
        initApp();
        // initApp();
        openWeb();
        api.parseTapmode();
    };

    function initApp() {
        vm = new Vue({
            el: '#app',
            data: {
                changeTime: 0,
                BSImg: {
                    big: Vue.BSImg == 'big',
                    small: Vue.BSImg == 'small'
                },
                title: '正在加载中...'
            },
            methods: {
    },
        });
    }

    function back() {
        webBrowser.historyBack(function (ret) {
            if (!ret.status) {
                closeWin();
            }
        });
    }

    function openWeb() {
        var forbid_urlschemes = null;
        if (getPrefs('forbid_urlschemes')) {
            forbid_urlschemes = JSON.parse(getPrefs('forbid_urlschemes'));
        }
        webBrowser.openView({
            url: url,
            rect: {
                x: 0,
                y: 60,
                w: 'auto',
                h: 'auto'
            },
            forbid_urlschemes: forbid_urlschemes || ["tbopen", "tmall", "taobao", "openapp.jdmoble"],
        }, function (ret, err) {

            switch (ret.state) {            //加载状态，数字类型，取值范围：0-开始加载；1-加载进度发生变化；2-结束加载；3-title发生变化；4-url发生变化
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    vm.changeTime++;
                    break;
                case 3:
                    vm.title = ret.title;
                    break;
                case 4:
                    break;
                case 5:
                    break;
                case 6:
                    break;
                default:
                    break;
            }
        })
    }

</script>
</html>
